package com.glodon.paas.monitor.server.biz.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import com.glodon.paas.job.exception.JsonException;
import com.glodon.paas.job.util.JsonUtil;

public class TaskEntity implements Serializable {

	private static final long	serialVersionUID	= -2490527676613040913L;

	// 主键
	private String				id;

	// 任务进队列时间
	private Date				createTime;

	// 任务出队列时间
	private Date				startTime;

	// 任务完成时间
	private Date				endTime;

	// 任务保存数据库时间
	private Date				jobServerSumbitTime;

	// 任务状态
	private String				status;

	// 任务类型
	private String				taskType;

	// 文件名称
	private String				originFilename;

	@SuppressWarnings("rawtypes")
	private transient Map		values				= new HashMap();

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public Date getJobServerSumbitTime() {
		return jobServerSumbitTime;
	}

	public void setJobServerSumbitTime(Date jobServerSumbitTime) {
		this.jobServerSumbitTime = jobServerSumbitTime;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getTaskType() {
		return taskType;
	}

	public void setTaskType(String taskType) {
		this.taskType = taskType;
	}

	public String getOriginFilename() {
		return originFilename;
	}

	public void setOriginFilename(String originFilename) {
		this.originFilename = originFilename;
	}

	public void setTaskInfo(String json) throws JsonException {
		values = JsonUtil.jsonToMap(json);
	}

	public String getTaskInfo() {
		return JsonUtil.mapToJson(values);
	}

	public Object getValue(String key) {
		return values.get(key);
	}

	public Map getValues() {
		return values;
	}

	public void addValue(String key, Object value) {
		values.put(key, value);
	}

	public void addValues(Map newValues) {
		values.putAll(newValues);
	}

}
